package com.ssm.model.mapper;


import org.apache.ibatis.annotations.*;

import com.ssm.model.bean.SsmUsers;


/**
 * 
 * SSMMapper用户类
 * @author WTC<546895488@qq.com>
 * @version 2016/1/29
 * 
 * */


public interface UserMapper extends BaseMapper<SsmUsers> {
	 
	/*
	 * 用户注册
	 */
	    @Insert("insert into ssm_users(username, password,createtime) values(#{username}, #{password},#{createtime})")
	    public int Resigter(@Param("username") String username,@Param("password") String password,@Param("createtime") String date);
	   
	    /*
	     * 用户更新
	     */
	    @Update("update ssm_users set name=#{name}, age=#{age} where id=#{id}")
	    public void updateUserInformation(SsmUsers user);
	   
	    
	    /*
	     * 查找用户
	     */
	    @Select("select * from ssm_users where id=#{id}")
	    public SsmUsers findById(int id);
	   
	    /*
	     * 删除用户
	     */
	    @Delete("delete from ssm_users where id=#{id}")
	    public void deleteUser(int id);
	   
	    /*
	     * 验证登陆
	     */
	    @Select("select * from ssm_users where username=#{username} AND password=#{password}")
	    public SsmUsers checkLogin(@Param("username") String username,@Param("password") String password);
	    
	    @Update("update ssm_users set lastloginip=#{IP},lastlogintime=#{date} where username=#{username} AND password=#{password}")
	    public void  updateUser(@Param("username") String username,@Param("password") String password,@Param("IP")String IP,@Param("date")String date);
	    
	    /*
	     * 
	     */

}
